<!--[if IE 7]>
<!DOCTYPE>
<html lang="en">
	<head>
<![endif]-->
<!--[if IE 8]>
<!DOCTYPE>
<html lang="en">
    <head>
           <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<![endif]-->
<![if gte IE 9]>
<!DOCTYPE HTML>
<html lang="en">
	<head>
<![endif]>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Chart 2D</title>
		<style type="text/css">
			@import "../../../dojo/resources/dojo.css";
			@import "../../../dijit/tests/css/dijitTests.css";
		</style>
		<!-- required for Tooltip: a default dijit theme: -->
		<link rel="stylesheet" href="../../../dijit/themes/tundra/tundra.css">
		<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true, async: true, parseOnLoad: true"></script>

		<script type="text/javascript">
			source = [
				{x: 1, y: 2.6, size: 0.3, fill: "orange"},
				{x: 2, y: 1.8, size: 0.4, fill: "orange"},
				{x: 3, y: 2, size: 0.1 },
				{x: 4, y: 1, size: 0.6},
				{x: 5, y: 1.4, size: 0.5},
				{x: 6, y: 0.7, size: 0.3},
				{x: 7, y: 2, size: 0.6}
			];
			var styleFunc, changeLimits;
			require([
			"dojo/dom",
			"dijit/registry",
			"dojox/charting/widget/Chart",
			"dojox/charting/axis2d/Default",
			"dojox/charting/plot2d/Bars",
			"dojox/charting/plot2d/Columns",
			"dojox/charting/plot2d/Bubble",
			"dojox/charting/plot2d/Areas",
			"dojox/charting/plot2d/Scatter",
			"dojox/charting/plot2d/Pie",
			"dojox/charting/themes/PlotKit/orange",
			"dojox/charting/themes/PlotKit/blue",
			"dojox/charting/themes/PlotKit/green", "dojo/parser"], function(dom, registry){
				changeLimits = function(){
					registry.byId("chart1").chart.getPlot("default").dirty = true;
					registry.byId("chart1").chart.render();
					registry.byId("chart2").chart.getPlot("default").dirty = true;
					registry.byId("chart2").chart.render();
					registry.byId("chart3").chart.getPlot("default").dirty = true;
					registry.byId("chart3").chart.render();
					registry.byId("chart4").chart.getPlot("default").dirty = true;
					registry.byId("chart4").chart.render();
					registry.byId("chart5").chart.getPlot("default").dirty = true;
					registry.byId("chart5").chart.render();
					registry.byId("chart6").chart.getPlot("default").dirty = true;
					registry.byId("chart6").chart.render();
				};
 				styleFunc = function(item){
					if(item.y < dom.byId("low").value){
						return { fill : "red" };
					}else if(item.y > dom.byId("high").value){
						return { fill: "green" };
					}
					return {};
				};
			});
		</script>
	</head>
	<body class="tundra">
		<h1>Test Chart Item Coloring</h1>
		<table border="0" cellspacing="30">
			<tr>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart1" style="width: 300px; height: 300px;"
							theme="dojox.charting.themes.PlotKit.blue">
						<div class="axis" name="x" fixUpper="major" includeZero="true" font="italic normal normal 8pt Tahoma"></div>
						<div class="axis" name="y" vertical="true" font="italic normal normal 8pt Tahoma"></div>
						<div class="plot" name="default" type="Bars" styleFunc="styleFunc" fill="'yellow'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart2" theme="dojox.charting.themes.PlotKit.orange" 
							fill="'lightgrey'" style="width: 300px; height: 300px;">
						<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div>
						<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true" minorLabels="false"
							font="italic normal bold 10pt Tahoma"></div>
						<div class="plot" name="default" type="Columns" styleFunc="styleFunc" fill="'yellow'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart3" theme="dojox.charting.themes.PlotKit.green"
							 style="width: 300px; height: 300px;">
						<div class="plot" name="default" type="Pie" radius="100" fontColor="white" styleFunc="styleFunc" fill="'yellow'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart4" theme="dojox.charting.themes.PlotKit.orange"
							fill="'lightgrey'" style="width: 300px; height: 300px;">
						<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div>
						<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true"
							font="italic normal bold 10pt Tahoma"></div>
						<div class="plot" name="default" type="Bubble" styleFunc="styleFunc" fill="'yellow'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart5" theme="dojox.charting.themes.PlotKit.orange"
							fill="'lightgrey'" style="width: 300px; height: 300px;">
						<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div>
						<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true"
							font="italic normal bold 10pt Tahoma"></div>
						<div class="plot" name="default" type="Scatter" styleFunc="styleFunc" markerFill="'yellow'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
				<td>
					<div data-dojo-type="dojox.charting.widget.Chart" id="chart6" theme="dojox.charting.themes.PlotKit.orange"
							fill="'lightgrey'" style="width: 300px; height: 300px;">
						<div class="axis" name="x" font="italic normal bold 10pt Tahoma"></div>
						<div class="axis" name="y" vertical="true" fixUpper="major" includeZero="true"
							font="italic normal bold 10pt Tahoma"></div>
						<div class="plot" name="default" type="Areas" styleFunc="styleFunc" markerFill="'yellow'" markers="true" fill="'blue'"></div>
						<div class="series" name="Run A" array="source"></div>
					</div>
				</td>
			</tr>
		</table>
		<label>Low Limit</label>
		<input id="low" type="text" onchange="changeLimits()" value="1"></input>
		<label>High Limit</label>
		<input id="high" type="text" onchange="changeLimits()" value="2"></input>
		<p>That's all Folks!</p>
	</body>
</html>
